<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">
<ui:define name="head">
    <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
    <script type="text/javascript" language="javascript">
        document.onkeydown = function TabReplace() {
            if (event.keyCode == 13) {
                if (event.srcElement.tagName != 'BUTTON')
                    event.keyCode = 9;
                else
                    event.srcElement.click();
            }
        }
    </script>
    <style type="text/css">
        .c_c {
            background: gray;
        }
    </style>
</ui:define>
<ui:define name="content">
<div style="margin:5px;">
<h:form id="form">
<p:growl id="msgs" showDetail="false"/>
<p:panel id="inputItemHieRelap" header="分包合同工程材料录入" style="width: 100%">
    <h:panelGrid columns="2" style="width: 100%">
        <h:panelGrid id="pgItemHieRelapInput" widgetVar="wvItemHieRelap"
                     columns="8" style="width: 100%">

            <h:outputLabel for="noItemHieRelap" value="编号:"/>
            <h:inputText id="noItemHieRelap"
                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_StrNo}"
                         style="font-weight:bold;background-color:gainsboro"
                         disabled="true">
            </h:inputText>

            <h:outputLabel for="name" value="名称:"/>
            <h:inputText id="name" value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_Name}"
                         style="font-weight:bold;background-color:gainsboro"
                         disabled="true"/>

            <h:outputLabel for="note" value="备注内容:"/>
            <h:inputTextarea id="note" value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_Note}"
                             rows="1" autoResize="false"
                             style="font-weight:bold;background-color:gainsboro"
                             disabled="true"/>

            <h:outputLabel for="unitItemInfo" value="单位:"/>
            <h:inputText id="unitItemInfo"
                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_Unit}"
                         style="font-weight:bold;background-color:gainsboro"
                         disabled="true"/>

            <h:outputLabel for="contractQuantityItemInfo" value="工程量:"/>
            <h:inputText id="contractQuantityItemInfo"
                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_ContractQuantity}"
                         style="font-weight:bold;background-color:gainsboro;text-align:right;float:left;"
                         disabled="true">
                <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
            </h:inputText>

            <h:outputLabel for="engMMng_BeginToCurrentPeriodMQty" value="材料累计供应数量:"/>
            <h:inputText id="engMMng_BeginToCurrentPeriodMQty"
                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.engMMng_BeginToCurrentPeriodMQty}"
                         style="font-weight:bold;background-color:gainsboro;text-align:right;float:left;"
                         disabled="true">
                <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
            </h:inputText>

            <h:outputLabel for="engMMng_CurrentPeriodMQty" value="当期材料供应数量:"/>
            <h:inputText id="engMMng_CurrentPeriodMQty"
                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.engMMng_CurrentPeriodMQty}"
                         style="font-weight:bold;text-align:right;float:left">
                <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                <p:ajax event="blur" update="msgs,engMMng_BeginToCurrentPeriodMQty"
                        listener="#{itemHieRelapStlEngMAction.blurEngMMng_CurrentPeriodMQty('blur')}"/>
            </h:inputText>

            <h:outputLabel for="signPartAPriceItemInfo" value="分包材料单价:"/>
            <h:inputText id="signPartAPriceItemInfo"
                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_SignPartAPrice}"
                         style="font-weight:bold;background-color:gainsboro"
                         disabled="true">
                <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
            </h:inputText>

        </h:panelGrid>
        <h:panelGrid id="pgItemHieRelapBtn" columns="2" style="width:100%">
            <p:commandButton id="submitBtn" value="提交"
                             action="#{itemHieRelapStlEngMAction.submitThisRecordAction}"
                             style="width:60px"
                             update="pgItemHieRelapInput,ptt,msgs,pgInputBlur,pgItemHieRelapBtn"
                             rendered="#{itemHieRelapStlEngMAction.submitBtnRendered}">
                <!--icon="ui-icon-disk"-->
            </p:commandButton>
            <p:commandButton id="resetBtn" value="重置"
                             action="#{itemHieRelapStlEngMAction.reSetAction}"
                             style="width:60px"
                             update="inputItemHieRelap,pcm">
            </p:commandButton>
        </h:panelGrid>
        <h:panelGrid id="pgInputBlur" columns="8" rendered="false">
            <h:outputLabel for="pkidItemHieRelap" value="Pkid:"/>
            <h:inputTextarea id="pkidItemHieRelap"
                             value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_Pkid}"
                             style="font-weight:bold;width:200px"
                             disabled="true"/>
            <h:outputLabel for="parentPkidItemHieRelap" value="父层Pkid:"/>
            <h:inputTextarea id="parentPkidItemHieRelap"
                             value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_ParentPkid}"
                             style="font-weight:bold;width:200px"
                             disabled="true"/>
            <h:outputLabel for="itemPkidItemHieRelap" value="项Pkid:"/>
            <h:inputTextarea id="itemPkidItemHieRelap"
                             value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_ItemPkid}"
                             style="font-weight:bold;width:200px"
                             disabled="true"/>
            <h:outputLabel for="correspondingPkidItemHieRelap" value="对应Pkid:"/>
            <h:inputTextarea id="correspondingPkidItemHieRelap"
                             value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_CorrespondingPkid}"
                             style="font-weight:bold;width:200px"
                             disabled="true"/>
            <h:outputLabel for="gradeItemHieRelap" value="层号:"/>
            <h:inputText id="gradeItemHieRelap"
                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_Grade}"
                         style="font-weight:bold"
                         disabled="true"/>
            <h:outputLabel for="orderidItemHieRelap" value="序号:"/>
            <h:inputText id="orderidItemHieRelap"
                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_Orderid}"
                         style="font-weight:bold"
                         disabled="true"/>
        </h:panelGrid>
    </h:panelGrid>
</p:panel>
<p:ajaxStatus style="width:16px;height:16px;">
    <f:facet name="start">
        <h:graphicImage value="/images/ajaxloading.gif"/>
    </f:facet>
    <f:facet name="complete">
        <h:outputText value=""/>
    </f:facet>
</p:ajaxStatus>
<p:contextMenu for="ptt" id="pcm"
               rendered="#{itemHieRelapStlEngMAction.strIsNullAndInitRendered}">
    <!--process="pgItemHieRelapInput,@this"执行范围-->
    <p:menuitem value="更新" icon="ui-icon-arrowrefresh-1-w"
                actionListener="#{itemHieRelapStlEngMAction.selectRecordAction('upd')}"
                update="inputItemHieRelap,msgs,ptt,pgItemHieRelapBtn">
    </p:menuitem>
    <p:menuitem value="删除" icon="ui-icon-close"
                actionListener="#{itemHieRelapStlEngMAction.selectRecordAction('del')}"
                update="inputItemHieRelap,msgs,ptt,pgItemHieRelapBtn">
    </p:menuitem>
</p:contextMenu>
<p:dataTable id="ptt" style="width:100%;"
             value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMngList}"
             var="record"
             rowKey="#{record.subctt_Pkid}"
             selection="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMngSelected}"
             selectionMode="single"
             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink}
                                                        {LastPageLink} {RowsPerPageDropdown}"
             paginator="true"
             paginatorPosition="bottom"
             rows="100"
             rowsPerPageTemplate="200,100,50,40,30,20,10"
             rowIndexVar="row"
             emptyMessage="数据记录为空..."
             rowStyleClass="#{record.subctt_SignPartAPrice eq 0? 'c_c':record.subctt_SignPartAPrice eq null? 'c_c':null}"
             stickyHeader="#{itemHieRelapStlEngMAction.strStickyHeaderFlag}">

    <p:column headerText="序号">
        <h:outputText value="#{row + 1}"/>
    </p:column>

    <p:column style="width:100px" headerText="编号">
        <h:outputText value="#{record.subctt_StrNo}" escape="false"/>
    </p:column>

    <p:column style="width:200px" headerText="名称">
        <h:outputText value="#{record.subctt_Name}"/>
    </p:column>

    <p:column style="width:30px" headerText="单位">
        <h:outputText value="#{record.subctt_Unit}" style="text-align:right"/>
    </p:column>

    <p:column style="width:80px" headerText="合同单价">
        <h:outputText value="#{record.subctt_ContractUnitPrice}" style="float: right">
            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
        </h:outputText>
    </p:column>

    <p:column style="width:80px" headerText="合同数量">
        <h:outputText value="#{record.subctt_ContractQuantity}" style="float: right">
            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
        </h:outputText>
    </p:column>

    <p:column style="width:80px" headerText="合同金额">
        <h:outputText value="#{record.subctt_ContractAmount}" style="float: right">
            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
        </h:outputText>
    </p:column>

    <p:column style="width:80px" headerText="分包材料单价">
        <h:outputText value="#{record.subctt_SignPartAPrice}" style="float: right">
            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
        </h:outputText>
    </p:column>

    <p:column headerText="备注内容">
        <h:outputText value="#{record.subctt_Note}"/>
    </p:column>

    <p:column headerText="分包合同PKID"
              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('engMMng_SubcttPkid').rendered_flag}">
        <h:outputText value="#{record.engMMng_SubcttPkid}"/>
    </p:column>

    <p:column headerText="对应分包合同项PKID"
              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('engMMng_ItemPkid').rendered_flag}">
        <h:outputText value="#{record.engMMng_ItemPkid}"/>
    </p:column>

    <p:column headerText="材料累计供应数量">
        <h:outputText value="#{record.engMMng_BeginToCurrentPeriodMQty}" style="float: right">
            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
        </h:outputText>
    </p:column>

    <p:column headerText="当期材料供应数量">
        <h:outputText value="#{record.engMMng_CurrentPeriodMQty}" style="float: right">
            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
        </h:outputText>
    </p:column>

    <p:columns value="#{itemHieRelapStlEngMAction.columnModelPeriodList}" var="column" columnIndexVar="colIndex">
        <f:facet name="header">
            #{column.column_name}
        </f:facet>
        #{column.comments}
    </p:columns>

    <f:facet name="footer">
        <div style="text-align: left">
            <p:commandButton id="mngFinishBtn" value="录入结束"
                             style="width:90px"
                             action="#{itemHieRelapStlEngMAction.mngFinish_SetInitToStatusFlagAction('4')}"
                             update=":form:msgs"
                             rendered="#{itemHieRelapStlEngMAction.strIsNullAndInitRendered}"/>
            <p:commandButton id="mngNotFinishBtn" value="重新录入"
                             style="width:90px"
                             action="#{itemHieRelapStlEngMAction.mngNotFinishAction('4')}"
                             update=":form:msgs"
                             rendered="#{itemHieRelapStlEngMAction.strIsNullAndInitRendered}"/>
        </div>
    </f:facet>
</p:dataTable>
</h:form>
</div>
</ui:define>
</ui:composition>